﻿using System;
using Castle.ActiveRecord;
using CostTrade.Core.Data;
using Natrue.Data.FastMapping;

namespace CostTrade.BusinessLayer
{
    /// <summary>
    /// 采购单内容
    /// </summary>
    [ActiveRecord("tbStockWares"), Serializable]
    public class StockWares : CBBase
    {
        private readonly Guid primaryKey = Guid.NewGuid();
        [PrimaryKey(PrimaryKeyType.Assigned, "ROWGUID", Access = PropertyAccess.NosetterCamelcase),Mark("")]
        public override Guid PrimaryKey
        {
            get { return primaryKey; }
        }

        /// <summary>
        /// 采购商品
        /// </summary>
        private Wares stockWare;
        /// <summary>
        /// 采购价格
        /// </summary>
        private double stockPrice;
        /// <summary>
        /// 对应采购单
        /// </summary>
        private Guid stockOrderGuid;

        /// <summary>
        /// 采购商品
        /// </summary>
        [BelongsTo, Mark("采购商品",IsNotNull = true)]
        public Wares StockWare
        {
            get { return stockWare; }
            set { stockWare = value; }
        }

        /// <summary>
        /// 采购价格
        /// </summary>
        [Property, Mark("采购价格")]
        public double StockPrice
        {
            get { return stockPrice; }
            set { stockPrice = value; }
        }

        /// <summary>
        /// 对应采购单
        /// </summary>
        [Property, Mark("对应采购单")]
        public Guid StockOrderGuid
        {
            get { return stockOrderGuid; }
            set { stockOrderGuid = value; }
        }
    }
}